<%@page import="com.karl.service.impl.UserManagerImpl"%>
<%@ page language="java" import="java.util.*, java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.karl.entity.*"%>
<%@ page import="com.karl.service.*" %>

<%

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String username = request.getParameter("username");
String password = request.getParameter("password");
String password2 = request.getParameter("password2");
User user = new User();
user.setUsername(username);
user.setPassword(password);
UserManager um = new UserManagerImpl();

boolean exist = um.exists(user);
if(exist){
	response.sendRedirect("registerFail.jsp");
	return;
}

um.add(user);
response.sendRedirect("registerSuccess.jsp");

%>